package com.qeado.site.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qeado.site.dao.LinkManageDao;
import com.qeado.site.model.FriendlyLink;
import com.qeado.site.service.LinkManageService;

@Service
public class LinkManageServiceImpl implements LinkManageService {
	
	@Autowired
	private LinkManageDao linkManageDao;
	

	public List<FriendlyLink> searchFriendlyLink(FriendlyLink friendlyLink) {
		return this.linkManageDao.getLinkListByLink(friendlyLink);
		
	}


	public String saveNewFriendlyLink(FriendlyLink friendlyLink) {
		if(linkManageDao.searchFriendlyLinkByAddress(friendlyLink) != null) 
			return "该链接已存在！";
		this.linkManageDao.insertNewLink(friendlyLink);
		return null;
	}


	public void deleteLink(FriendlyLink friendlyLink) {
		this.linkManageDao.deleteLinkByAddr(friendlyLink);
	}

}
